Skip to content

Add Git Tools to Navigator#51

Merged
dwash96 merged 4 commits intocecli-dev:coroutine-experimentfrom
devsoft-co-za:git_tools
Oct 25, 2025
Merged

Add Git Tools to Navigator#51
dwash96 merged 4 commits intocecli-dev:coroutine-experimentfrom
devsoft-co-za:git_tools

Conversation

@devsoft-co-za
Copy link
Copy Markdown

Added a new git.py in tools and some code to make it work in navigator_coder.py
Also changed pyproject.toml, not sure about this part but it was necessary to make it work.

Result: Aider Navigator can now use git. Ask it to check the diff between branches (good to re-implement the bits that LLM's always miss when re-factoring for example). I even simulated a merge conflict and it dealt with that easily.

Despite the additions here only dealing with read-only commands like diff, log, show and status, Navigator was able to do other git operations when asked such as commit and merge, using the command_string tool. This brings up the question:
Is this new git functionality necessary?

I am going to let the AI answer that one:

Looking at the new git tools, they're actually quite valuable and serve a different purpose than the command_string tool. Here's why they're necessary:

Key Differences:

  1. Type Safety & Validation: The git tools have structured schemas that define exactly what parameters they accept and what they return, making them more reliable for the AI to use correctly.
  2. Error Handling: They include proper error handling for git-specific errors using ANY_GIT_ERROR, providing better user feedback than raw command execution.
  3. Repository Integration: They leverage the existing coder.repo infrastructure, which means they work with aider's git abstraction layer rather than just shelling out.
  4. Consistent Interface: They follow the same pattern as other aider tools, making them predictable and easy to maintain.
  5. Safety: They limit what git operations can be performed - no destructive operations like git reset --hard or git push are exposed.

Comparison:

  • command_string: General purpose, can run any shell command (including potentially dangerous ones)
  • git_* tools: Specific, safe git operations with proper validation and error handling
    The git tools provide a safer, more structured way to access git functionality compared to raw shell commands, which aligns with aider's tool philosophy of providing controlled, well-defined operations.

@dwash96
Copy link
Copy Markdown
Collaborator

dwash96 commented Oct 22, 2025

I've no issue with any of the code here, but would you mind setting up the formatting tool chain? It's essentially:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Will let you know the formatting errors/fix a few of them

@tomjuggler
Copy link
Copy Markdown

Sorry, it's my first time working with Aider codebase. I will try to wrangle the code into the correct format.

removed un-used import in git.py, navigator_coder.py
@devsoft-co-za
Copy link
Copy Markdown
Author

The pre-commit now reports no errors. I'm just testing some more after re-installing. And getting confused between github accounts..

@devsoft-co-za
Copy link
Copy Markdown
Author

So I have been using Aider with this new git tools for a couple of days now - no errors to report

I think the main question is whether anyone needs this - considering the already present command_string tool.

I would like to think of this as the start of a more comprehensive git tool which can handle complex merges and re-base etc (the hard stuff) safely, acting as a guide to the LLM. Would love to hear other's thoughts on this. Will having only part of git functionality handled by this tool (for now) be confusing? It confused me a bit when command_string took over.

I am a bit scared of the command_string tool tbh it has done some stuff I didn't ask it to, but that's another conversation.

From my side, I would like to have this as part of aider-ce, with the proviso that it will be upgraded in the future to handle ALL of git functionality (if possible) - or at least more stuff. The current implementation does not interfere at all with Aider doing auto commits, or /git mode, that is a separate process (but uses the same Python library).

@dwash96
Copy link
Copy Markdown
Collaborator

dwash96 commented Oct 25, 2025

I think expanding git tool capabilities over time is a good one! I don't think it's problematic for navigator mode to handle git commands explicitly and command_string is definitely suspiciously powerful. There almost certainly should be a navigator mode configuration at some point for things like allowed tool calls, and allowed executables it can run and forced confirmations. Something I'll keep in mind.

I will merge this in the version I make today, though so very much appreciate the contribution!

@dwash96 dwash96 merged commit c5fb154 into cecli-dev:coroutine-experiment Oct 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants